package com.chandra.pos.product.dao.entity;

import com.chandra.pos.customer.dao.entity.Customer;
import com.chandra.pos.model.PosEntity;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * Created with IntelliJ IDEA.
 * Customer: T4671
 * Date: 10/5/13
 * Time: 10:25 AM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name="PRODUCTS")
public class Product extends PosEntity {



    @Column(name="NAME", unique = true, nullable = true)
    private String name;

    @Column(name="SALE_PRICE", unique = false, nullable = true)
    private BigDecimal salePrice;

    @Column(name="COST_PRICE", unique = false, nullable = true)
    private BigDecimal  costPrice;

    @Column(name="STOCK_QUANTITY", unique = false, nullable = true)
    private BigDecimal stockQuantity;

    @Column(name = "REORDER_QUANTITY", unique = false, updatable = true, insertable = true)
    private BigDecimal reorderQuantity;

    @Column(name = "STATUS")
    private int status;

    @Enumerated(EnumType.ORDINAL)
    @Column(name = "UNIT_TYPE_ID")
    private UnitType unit = UnitType.KG;

    @Column(name="DESCRIPTION", unique = false, nullable = true)
    private String description;


    @OneToOne
    @JoinColumn(name = "CATEGORY_ID", unique = false, nullable = true)
    @NotFound(action = NotFoundAction.IGNORE)
    private Category category;



    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice;
    }

    public BigDecimal getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(BigDecimal costPrice) {
        this.costPrice = costPrice;
    }

    public BigDecimal getStockQuantity() {
        return stockQuantity;
    }

    public void setStockQuantity(BigDecimal stockQuantity) {
        this.stockQuantity = stockQuantity;
    }
    public UnitType getUnit() {
        return unit;
    }

    public void setUnit(UnitType unit) {
        this.unit = unit;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public BigDecimal getReorderQuantity() {
        return reorderQuantity;
    }

    public void setReorderQuantity(BigDecimal reorderQuantity) {
        this.reorderQuantity = reorderQuantity;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }
}
